package BO;

import java.util.ArrayList;

import DB.ItemDB;


public class Item {
	private int itemId;
	private int category;
	private String name;
	private float price;
	private String description;
	private int amount;
	
	protected Item(int itemId, int category, String name, float price, String description, int amount){
		this.itemId = itemId;
		this.category = category;
		this.name = name;
		this.price = price;
		this.description = description;
		this.amount = amount;
	}
	
	public int getItemId() {
		return itemId;
	}
	
	public int getCategory() {
		return category;
	}

	public void setCategory(int category) {
		this.category = category;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	public int getAmount(){
		return amount;
	}

	@Override
	public String toString() {
		return "Item [itemId=" + itemId + ", category=" + category + ", name="
				+ name + ", price=" + price + ", description=" + description
				+ ", amount=" + amount + "]";
	}


	public static ArrayList<Item> getItemsByCategoryName(String categoryName){
		return ItemDB.getItemsByCategoryName(categoryName);
	}

	public static void updateItem(int id, int category, String name, float price, String description, int amount){
		ItemDB.updateItem(id, category, name, price, description, amount);
	}
	
	public static Item getItemById(int id){
		return ItemDB.getItemById(id);
	}
	
	public static void createItem(int category, String name, float price, String description, int amount){
		ItemDB.createItem(category,name,price,description,amount);
	}

}
